package com.gua.jbs.daoImpl;

import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import com.gua.jbs.dao.IBillDao;
import com.gua.jbs.pojo.Jbscit;
import com.gua.jbs.utility.DBConstant;
import com.gua.jbs.utility.QueryConstant;

public class BillDao extends BaseDao implements IBillDao {

	@Override
	public boolean saveBill(Jbscit jbscit) {
		// Prepare the parameters
		List lParamList = new ArrayList();
			
		//set the parameters
		lParamList.add(0, "1");
		lParamList.add(1, jbscit.getCustFName());
		lParamList.add(2, jbscit.getCustLName());
		lParamList.add(3, jbscit.getCustAddress());
		lParamList.add(4, jbscit.getCustExtraAddr());
		lParamList.add(5, jbscit.getCustLandmark());
		lParamList.add(6, jbscit.getCustMobile());
		lParamList.add(7, jbscit.getCustHomePhone());
		lParamList.add(8, jbscit.getCustEmailAddr());
		lParamList.add(9, 1);
		lParamList.add(10, 1);
		lParamList.add(11, 1);
		lParamList.add(12, DBConstant.IS_ACTIVE_YES);
		lParamList.add(13, new Timestamp(new Date().getTime()));
		lParamList.add(14, new Timestamp(new Date().getTime()));
		lParamList.add(15, jbscit.getExtrafield1());
		lParamList.add(16, null);
		lParamList.add(17, null);
		lParamList.add(18, "Yogesh");
		lParamList.add(19, "Yogesh");
		
		// Get the query by passing parameters
		String query = getQuery(QueryConstant.SAVE_CUST_BILL, lParamList);
		
		int resultCount=0;
		try {
			resultCount = insert(query);
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		if (resultCount != 0) {
			return true;
		} else
			return false;

	}

}
